package dao;

import common.User;

import java.sql.Connection;
import java.sql.PreparedStatement;
import java.sql.ResultSet;
import java.sql.SQLException;
import java.util.Vector;

public class GetSelected {
    private static Connection conn = DataBaseConnect.getConn();
    private static String sql = "select studentid from select_peop where selecttaskid=?";
    private static PreparedStatement pstmt;

    static {
        try {
            pstmt = conn.prepareStatement(sql);
        } catch (SQLException e) {
            e.printStackTrace();
        }
    }
    public static Vector<User> getSelected(String selecttaskid){
        Vector<User> selected=new Vector<>();
        try {
            pstmt.setString(1,selecttaskid);
            ResultSet rs=pstmt.executeQuery();
            while(rs.next()){
                User stu=PwdFromBase.getInfo(rs.getString(1));
                selected.add(stu);
            }
        } catch (SQLException e) {
            throw new RuntimeException(e);
        }
        return selected;
    }
}
